Update BenhNhans set HemosolCitrat=''

DECLARE @IdBenhNhan int
DECLARE @NgayChay DateTime

DECLARE UpdateBenhNhan_cursor CURSOR FOR SELECT IdBenhNhan, NgayChay FROM ChayThanNhanTao order by IdChayThanNhanTao asc
OPEN UpdateBenhNhan_cursor 
FETCH NEXT FROM UpdateBenhNhan_cursor INTO @IdBenhNhan, @NgayChay 
WHILE @@FETCH_STATUS = 0
BEGIN
	update BenhNhans set HemosolCitrat = (CAST(HemosolCitrat as nvarchar(4000)) + Convert(nvarchar(4000),@NgayChay,101) + '=')
	where BenhNhans.IdBenhNhan = @IdBenhNhan
FETCH NEXT FROM UpdateBenhNhan_cursor INTO @IdBenhNhan, @NgayChay
END

CLOSE UpdateBenhNhan_cursor 
DEALLOCATE UpdateBenhNhan_cursor